
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import {applyMiddleware, createStore } from 'redux';
import { createLogger } from 'redux-logger';
import { connect, Provider } from 'react-redux'
import { Reducers } from './reducers'
import { actions } from './action'



const Counter = ({ value, onIncrement, onDecrement }) => (
  <div>
    <h1>{value}</h1>
    <button onClick={onIncrement}>+</button>
    <button onClick={onDecrement}>-</button>
  </div>
);

let store = createStore(Reducers);

store = createStore(
  Reducers,
  applyMiddleware(createLogger())
);



const render = () => {
  ReactDOM.render(
    <Counter
      value={store.getState().ADDreducer}
      onIncrement={() => store.dispatch(actions[0])}
      onDecrement={() => store.dispatch(actions[4])}
    />,
    document.getElementById('root')
  );
};

render();
store.subscribe(render);